<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../../../common.jsp"%>
<script type="text/javascript">
function save1() {
	if(values==1){
		document.getElementById('biAuthor').value=$("#othor").val();		
	}else{
		document.getElementById('biAuthor').value=$("#studentview.id").val();		
	} 

        var pagetype="add";   
        var TOKEN=$("#TOKEN").val();
        var biAuthor=$("#biAuthor").val();
        var edId=$("#edId").val();
        var amount=$("#amount").val();
        var remark=$("#remark").val();
        var introduction=$("#introduction").val();
    	$.post("${rootDir }/funds/add.income.do",
      	{	
    		pagetype:pagetype,
    		TOKEN:TOKEN,
    		biAuthor:biAuthor,
    		edId:edId,
    		amount:amount,
    		remark:remark,
    		introduction:introduction
		},function(data)
				{
				$.pdialog.closeCurrent();
				}
		);
    	}
function save() {
	if($("#userstat").val()==1){
		document.getElementById('inAuthor').value=document.getElementById('personview.id').value;
		document.getElementById('studentview.id').value=document.getElementById('personview.id').value;
	}else{
		document.getElementById('inAuthor').value=document.getElementById('studentview.id').value;	
		document.getElementById('personview.id').value=document.getElementById('studentview.id').value;
	} 
	var auditForm=$("#form1");  
	 auditForm.submit(); 
    }
function setPerson(values) {
	if(values==1){
		document.getElementById('student_p').style.display='none';
		document.getElementById('othor_p').style.display='';
		
	}else{
		document.getElementById('student_p').style.display='';
		document.getElementById('othor_p').style.display='none';
	} 
  }
</script>
<div class="pageContent">
	<form id="form1" method="post" action="${rootDir }/funds/add.income.do" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
		<input type="hidden" name="TOKEN" id="TOKEN" value="${TOKEN}">
		<input type="hidden" name="pagetype" id="pagetype" value="add">	
		<input type="hidden" name="inAuthor" id="inAuthor">	
		<div class="pageFormContent" layoutH="56">
		<p>
			<label>付款人类型：</label>
			<select id="userstat" name="userstat" class="required combox" onchange="setPerson(this.value);">
					<option value="0" selected>学生</option>
					<option value="1">其他</option>
			</select>
		</p>		
		<p id="othor_p" style="display:none">
			<label>付款人名称：</label>
			<input name="personview.id" id="personview.id" type="hidden" value=""/>
			<input id="personview" name="dwz.personview.orgName" type="text" suggestFields="orgNum,orgName" 
					suggestUrl="${rootDir }/select/list.person.do" lookupGroup="personview" value="" readonly="readonly" size="26" />
				<a class="btnLook" href="${rootDir }/select/list.person.do" lookupGroup="personview"  id="lookupCourseCate">查找带回</a>	
		
		</p>
		<p id="student_p">
				<label>学生：</label>
				<input name="studentview.id" id="studentview.id" type="hidden" value=""/>
				<input id="studentview" name="dwz.studentview.orgName" type="text" suggestFields="orgNum,orgName" 
					suggestUrl="${rootDir }/select/list.student.do" lookupGroup="studentview" value="" readonly="readonly" size="26" />
				<a class="btnLook" href="${rootDir }/select/list.student.do" lookupGroup="studentview"  id="lookupCourseCate">查找带回</a>	
		</p>
		<p>
			<label>收款类型：</label>
			<select id="financeType" name="financeType" class="required combox">
				  <option value="" selected>请选择</option>
				  <c:forEach items="${inLst}" var="reslst" varStatus="status">
					<option value="${reslst.id}">${reslst.TName}</option>
				</c:forEach>	
			</select>
		</p>
		<p>
			 <label>收款时间：</label>
					<input id="biDate" type="text" name="biDate" class="required date" size="30" />
		</p>
		<p>
		  	<label>金额：</label>
			<input type="text" id="amount" name="amount" class="required number textInput valid">
			<label for="amount" class="alt" style="width: 188px; top: 5px; left: 130px; opacity: 1;"></label>
		</p>
		<p>
			<label>收款人名称：</label>
			<select id="biAuthor" name="biAuthor" class="required combox">
					 <option value="" selected>请选择</option>
					 <c:forEach items="${auLst}" var="reslst" varStatus="status">
						<option value="${reslst.id}" <c:if test="${status.count==1 }">selected</c:if>>${reslst.TName}</option>
					</c:forEach>	
			</select>
		</p>
			<p>
				<label>备注：</label> <input id="remark" name="remark" type="text"
					size="30" value="" alt="" />
			</p>
			<div class="divider"></div>		
			<p>
				<label>说明：</label>
				<textarea cols="65" rows="5" id="introduction" name="introduction"></textarea>
			</p>	
	  </div>
		<div class="formBar">

			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>淇濆瓨</span></a></li>-->
				<li><div class="buttonActive"><div class="buttonContent">
				<button type="button" onclick="javascript:save()">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>

	</form>
</div>
